﻿function Exist()
{
	var username=document.getElementById("username").value;
	var password=document.getElementById("password").value;
	if(username=="admin"&&password=="admin")
	{
		return true;
	}
}

function loginResult()
{
	
	var username=document.getElementById("username").value;
	var password=document.getElementById("password").value;
	if(username.length==0){
		alert("请输入用户名！");
		return;
	}else if(password.length==0){
		alert("请输入密码！");
		return;
	}
	
	$.ajax({
		url:"userAction!login",
		type:"post",
		async:false,
		data:{'email':username,'password':password},
		success:function(result,status){
			var objs = eval("("+result+")");
			
			if(objs['errorMsg'].length!=0){
				alert("登录失败哦："+objs['errorMsg']);
			}else
			{
			
				location.href="userCenter.jsp";
			}
			
		}
		
	});
	
}